package com.sinodata.bsm.cicp.finder.weblogic8;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.sinodata.bsm.cicp.finder.Finder;

public class JvmFinder extends Finder {

    //private static final Logger logger = Logger.getLogger(JvmFinder.class);

    /*@Override
    @SuppressWarnings("unchecked")
    public List find(ResValue pResValue, ResAttributeValValue[] pAttrVals, ResAttributeValue[] attributes) {
        String serverName = pAttrVals[0].getAttrValue();

        List resources = new ArrayList();
        Object oneResource = CreateOneResource(serverName, " JVM", attributes);
        resources.add(oneResource);
        logger.info("find weblogic8 jvm");
        return resources;
    }*/

    /*private Object CreateOneResource(String serverName, String name, ResAttributeValue[] attributes) {
        List oneResource = new ArrayList();
        // Resource
        ResValue res = new ResValue();
        res.setIp(host); // host IP address
        res.setName(name);// resource name
        res.setInternalId(host + "_weblogic_" + serverName + "_" + "JVM"); // Internal
        // ID
        // for
        // agent
        res.setDescript("JVM:" + name); // resource description
        oneResource.add(res);

        // Resource attributes
        ResAttributeValValue attribute = new ResAttributeValValue();
        attribute.setResAttributeId(attributes[0].getId());
        attribute.setAttrValue(serverName + "_JVM");
        oneResource.add(attribute);

        return oneResource;
    }*/

    @SuppressWarnings("unchecked")
    @Override
    public List<String[]> find(String ip, Map params) {
        String serverName = (String) params.get("SERVERNAME");
        List<String[]> list = new ArrayList<String[]>();
        String[] info = new String[4];
        info[0] = ip + "_weblogic_" + serverName + "_" + "JVM";
        info[1] = " JVM";
        info[2] = "JVM:" + " JVM";
        info[3] = serverName + "_JVM";
        return list;
    }
}
